<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
            <title>
            </title>
            <link href="__LAYUI__/css/layui.css" rel="stylesheet" type="text/css"/>
            <script src="__LAYUI__/layui.js" type="text/javascript">
            </script>
            <script src="__STATIC__/js/form.js" type="text/javascript">
            </script>
        </meta>
    </head>
    <body>
        <form class="layui-form" name="userForm" style="margin: 20px 50px;">
            <div class="layui-form-item">
                <label class="layui-form-label">
                    用户名
                </label>
                <div class="layui-input-inline">
                    <input class="layui-input" readonly="readonly" name="username" type="text">
                    </input>
                </div>
                <label class="layui-form-label">
                    用户级别
                </label>
                <div class="layui-input-inline">
                    <input class="layui-input" name="level" type="text">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">
                    密码
                </label>
                <div class="layui-input-inline">
                    <input class="layui-input" name="password"  type="text">
                    </input>
                </div>
                <label class="layui-form-label">
                    身份证号
                </label>
                <div class="layui-input-inline">
                    <input class="layui-input" name="identity" type="text">
                    </input>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">
                    手机
                </label>
                <div class="layui-input-inline">
                    <input class="layui-input" name="mobile" type="text">
                    </input>
                </div>
                <label class="layui-form-label">
                    邀请人ID
                </label>
                <div class="layui-input-inline">
                    <input class="layui-input" name="invite" type="text">
                    </input>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">
                    邮箱
                </label>
                <div class="layui-input-inline">
                    <input class="layui-input" name="email" type="text">
                    </input>
                </div>
                <label class="layui-form-label">
                    代理
                </label>
                <div class="layui-input-inline">
                    <input class="layui-input" name="agent" type="text">
                    </input>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">
                    昵称
                </label>
                <div class="layui-input-inline">
                    <input class="layui-input" name="nickname" type="text">
                    </input>
                </div>
                <label class="layui-form-label">
                    QQ号
                </label>
                <div class="layui-input-inline">
                    <input class="layui-input" name="qq" type="text">
                    </input>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">
                    真实姓名
                </label>
                <div class="layui-input-inline">
                    <input class="layui-input" name="realname" type="text">
                    </input>
                </div>
                <label class="layui-form-label">
                    微信号
                </label>
                <div class="layui-input-inline">
                    <input class="layui-input" name="wechat" type="text">
                    </input>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                        <input name="id" style="display: none;" type="text">
                        <button class="layui-btn layui-btn-normal" lay-filter="user" lay-submit="">
                            提交
                        </button>
                    </input>
                </div>
            </div>
        </form>
        <script type="text/javascript">
            var formObj = new Form('userForm');
                formObj.init({$user});

            layui.use(['form','layer'], function(){
                var $ = layui.jquery;
                var layer = layui.layer;
                var form = layui.form();

            form.on('submit(user)', function(e){
                $.post("{:url('admin/User/edit')}", e.field, function(res){
                    if(res.status == 1){
                      layer.msg(res.msg,{time:1000},function(){
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                        parent.location.reload();
                      });
                    }else{
                      layer.msg(res.msg);
                    }
                },'json');
                return false;
            });

            });
        </script>
    </body>
</html>
